<div class="subSubmit" style="display: none" id="subSubmit">
    <form action="/admin/addSubcaseBySubmited" method="post" id="subForm">
        <input  id="subid" class="caseName"  name="subid" style="visibility: hidden">
        <input type="text" class="caseName" name ="casename" id="caseName" readonly="readonly">
        <textarea class="abstract caseName" name = "abstract" id="abstract"> </textarea>
        <textarea class="techPra caseName" name="techpra" id="techPra"></textarea>
        <textarea class="process caseName" name="process" id="process"></textarea>
        <input class="pics caseName" name="pics" id="pics">
        <div id="sub-imgShow" class="caseName">
        </div>
        <input class="sub-submitButton" type="submit" value="提交">
        <input class="sub-submitButton" type="button" value="取消" onclick="closeSubSubmit()">
    </form>

</div>

<style>
    .subSubmit{
        width: 100%;
        height: auto;
        position: relative;
        z-index: 10;
        background-color: #666666;
    }
    .caseName{
        width: 800px;
        height: auto;
        margin: auto;
        border: none;
        outline: none;
        display: block;
        font-size: large;
        border-bottom: black solid 1px;
    }
    .caseName:focus{
        outline: none;
    }
    #caseName{
        width: 400px;
        height: 100px;
        text-align: center;
        font-size: large;

    }
    #abstract{
        height: 200px;
    }
    #techPra{
        height: 200px;
    }
    #process{
        height: 200px;
    }
    #pics{
        visibility: hidden;
    }
    #sub-imgShow{
        height: 200px;
        overflow: auto;
        position: relative;
        top: -20px;
    }
    .sub-submitButton{
        width: 40px;
        height: 30px;
        position: relative;
        top: -20px;
        left: 800px;
    }


</style>

<script>
    function SubmitSure(id) {
        //根据id 配置textarea id 和图片id
        alert("确定吗？")
        let images = [] ;
        let f =["caseName", "abstract", "techPra", "process", "pics"]
        let text = [];
        let imgdivId = "";
        for (let i = 1; i<=3;i++){
            text[i] = "case"+id+"-"+"textarea"+i
        }
        let subid = document.getElementById("subid");
        subid.value = id;

        let caseName = "case"+id+ "Name";
        document.getElementById(f[0]).value=document.getElementById(caseName).innerText

        for (let j =1; j<=3; j++){
             document.getElementById(f[j]).value = document.getElementById(text[j]).value;
        }
        imgdivId = "case"+id+"-"+"img"
        let imgs =document.getElementById(imgdivId).querySelectorAll("img");

        let imgcontainer = document.getElementById("sub-imgShow");
        for (let m = 0; m<imgs.length; m++){
            images[m] = imgs[m].name;
            //添加图片到提交表单中
            let subimage = document.createElement("img")
            subimage.src = imgs[m].src
            subimage.width = 800;
            imgcontainer.appendChild(subimage)

        }
        document.getElementById(f[4]).value = images




    //    显示提交表达div
       let subSubmit = document.getElementById("subSubmit")
        subSubmit.style['display'] = 'block'
    }
    
    function closeSubSubmit() {
        let subSubmit = document.getElementById("subSubmit")
        subSubmit.style['display'] = 'none'

    }
    
</script>